﻿using Abp.Configuration;
using Abp.Net.Mail;
using Abp.Net.Sms;
using Microsoft.Extensions.Configuration;
using System.Collections.Generic;

namespace HCD.Configuration
{
    public class HostSmsSettingProvider : SettingProvider
    {
        /// <summary>
        /// 读取appsetting.json配置
        /// </summary>
        public IConfiguration Configuration { get; set; }

        public override IEnumerable<SettingDefinition> GetSettingDefinitions(SettingDefinitionProviderContext context)
        {
            return new[]
            {
                // Sms config
                new SettingDefinition(SmsSettingNames.ServiceUrl,
                    Configuration["HostSmsSetting:ServiceUrl"] ?? ""),
                new SettingDefinition(SmsSettingNames.AppKey,
                    Configuration["HostSmsSetting:AppKey"] ?? ""),
                new SettingDefinition(SmsSettingNames.AppSecret,
                    Configuration["HostSmsSetting:AppSecret"] ?? ""),
                new SettingDefinition(SmsSettingNames.DefaultFreeSignName,
                    Configuration["HostSmsSetting:DefaultFreeSignName"] ?? ""),
                new SettingDefinition(SmsSettingNames.DefaultSmsTemplateCode,
                    Configuration["HostSmsSetting:DefaultSmsTemplateCode"] ?? "")
            };
        }
    }
}
